package team.bluepen.supermarket.data.entity;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Collection;

/**
 * @author RollW
 */
public class ProductIdNamesAmountVo {
    @JsonProperty("id")
    private final long id;

    @JsonProperty("amounts")
    private final Collection<ProductNameStatusAmount> amounts;

    public ProductIdNamesAmountVo(long id, Collection<ProductNameStatusAmount> amounts) {
        this.id = id;
        this.amounts = amounts;
    }

    public long getId() {
        return id;
    }

    public Collection<ProductNameStatusAmount> getAmounts() {
        return amounts;
    }

    public static ProductIdNamesAmountVo from(ProductIdNamesAmount amount) {
        return new ProductIdNamesAmountVo(
                amount.getId(),
                amount.getAmounts().values());
    }
}
